package com.ushine.design.design.a_creative_mode.d_builder.b_example;

/**
 * 角色控制器：
 * 充当指挥者。
 *
 * @author yls
 */
public class ActorController {
    //逐步构建复杂产品对象
    public Actor construct(ActorBuilder ab) {
        ab.buildType();
        ab.buildSex();
        ab.buildface();
        ab.buildConstume();
        //通过钩子方法来控制产品的构建
        if (ab.isBareheaded()) {
            ab.buildHairstyle();
        }
        Actor actor = ab.createActor();
        return actor;
    }
}
